﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="persondoc_mydoc_search.aspx.cs" Inherits="Ccit.OA.PersonDoc.persondoc_mydoc_search" %>
<%@ Register TagPrefix="ccit" Namespace="Ccit.ServerControls" Assembly="Ccit.ServerControls.ActionForm" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>文档检索</title>
    <link href="css/enter.css" rel="stylesheet" type="text/css">
    <script language="javascript" type="text/javascript" src="../script/jquery.js"></script>
    <script language="javascript" type="text/javascript" src="../script/StringClass_Ext.js"></script>
    <script language="javascript" type="text/javascript" src="../script/jsonlib.js"></script>
    <script language="javascript" src="../script/jwindow.js" type="text/javascript"></script>
    <script language="javascript" src="../script/jcontrol.js" type="text/javascript"></script>
    <script language="javascript" src="../script/jbase64.js" type="text/javascript"></script>
    
    <script language="javascript" src="../persondoc/calendar/wpCalendar.js" type="text/javascript"></script>
    <script language="javascript">
        function dodisplay(trname,imgname)
        {
            if(document.getElementById(trname).style.display == "none")
            {
                document.getElementById(trname).style.display = "block";
                document.getElementById(imgname).src = "../images/public/moveup.gif";
            }
            else
            {
                document.getElementById(trname).style.display = "none";
                document.getElementById(imgname).src = "../images/public/movedown.gif";
            }
        }
   
       function doSearch()
       {
        
            var StateTime = "";//开始时间
            var EndTime = "";//结束时间
            var SmallSize ="";//文件最小大小 (单位：M)
            var BigSize =""; //文件最大值  (单位：M)
            var TimeRange = "";
            var SizeRange = "";
            var  Range = document.getElementById("ddfiletype").value; //查找范围      
                 
           
            
            
            var radListItems = document.all("rbDatetime");   
            if(document.getElementById("trupdate").style.display == "block")
            {
                for(var i = 0; i <   5 ; i++ )
                {
                    if(radListItems[i].checked  == true)
                    {
                        TimeRange = radListItems[i].value;
                    }
                }  
            }
             
            radListItems = document.all("rbsize");   
            if(document.getElementById("trsize").style.display == "block")
            {
                for(var i = 0; i <   5 ; i++ )
                {
                    if(radListItems[i].checked  == true)
                    {
                        SizeRange = radListItems[i].value;
                    }
                }  
            }
            
            
            
            
            var myDate = new Date(); 
            if(document.getElementById("trupdate").style.display == "block")
            {
                alert("TimeRange");
                switch (TimeRange)
                {
                    case "0":
                        
                        StateTime = "";
                        EndTime = "";
                        break;
                    case "1":
                        if(myDate.getDate() <= 7)
                        {
                            StateTime = myDate.getFullYear() +"-"+ (myDate.getMonth()-1) + "-"+"22";  
                        }
                        else
                        {
                            StateTime = myDate.getFullYear() +"-"+ myDate.getMonth() + "-" + (myDate.getDate()-7);
                        }
                        EndTime = myDate.getFullYear() +"-"+ myDate.getMonth() + "-" + myDate.getDate();
                        break;
                     case "2":
                        StateTime = myDate.getFullYear() +"-"+ (myDate.getMonth()-1) + "-" + myDate.getDate();
                        EndTime = myDate.getFullYear() +"-"+ myDate.getMonth() + "-" + myDate.getDate();
                        break;
                     case "3":
                        StateTime = (myDate.getFullYear()-1) +"-01-01";
                        EndTime = (myDate.getFullYear()-1) +"-12-31";
                        break;
                     case "4":
                        if(document.getElementById("tbdate").style.display == "block")
                        {
                        
                            if(document.getElementById("txtstate").value == "" || document.getElementById("txtstate").value == "")
                            {
                                alert('时间填写不完整!');
                                return false;
                            }
                            if(document.getElementById("txtstate").value != "" && document.getElementById("txtstate").value != "" )
                            {
                                var arr=txtstate.split("-"); 
                                StateTime=new Date(arr[0],arr[1],arr[2]); 
                                var starttimes=StateTime.getTime();

                                var arrs=txtEnd.split("-"); 
                                EndTime=new Date(arrs[0],arrs[1],arrs[2]); 
                                var lktimes=EndTime.getTime();

                                if(StateTime>=EndState) 
                                {

                                    alert('开始时间大于结束时间，请检查');
                                    return false;
                                }
                            }
                        }
                     break;
                    default:
                        return false;
                    break;
                }
            }
            
            if(document.getElementById("trsize").style.display == "block")
            { 
             alert("trsize");
                switch(SizeRange)
                {
                    case "0":
                        SmallSize = "";
                        BigSize = "";
                    break;
                    case "1":
                       SmallSize = "0";
                        BigSize = Number("100")*1024;
                    break;
                    case "2":
                        SmallSize = "0";
                        BigSize = Number("1024")*1024;
                    break;
                    case "3":
                        SmallSize = Number("1024")*1024;
                        BigSize = "";
                    break;
                    case "4":
                        if(document.getElementById("tasize").style.display == "block")
                        {
                            if(document.getElementById("txtsizezd").value == "")
                            {
                                alert('未输入要查找的文件大小');
                                return false;
                            }
                            if(isNaN(document.getElementById("txtsizezd").value))
                            {
                                alert("指定大小处只允许输入数字!");
                                return false;
                            }
                            if(document.getElementById("DDsizezd").value == "0")
                            {
                                SmallSize = document.getElementById("txtsizezd").value*1024;
                                BigSize = "";
                            }
                            else
                            {
                                SmallSize = "";
                                BigSize = document.getElementById("txtsizezd").value*1024;;
                            }
                        }
                    break;
                    default:
                    break;
                }
            }
            
            var encodeparam ;
            var sParaXml;
            sParaXml = "<Query>";
            sParaXml += "<TitleName>" + document.getElementById("txtfilename").value + "</TitleName>";
            sParaXml += "<Range>" + Range + "</Range>";
            sParaXml += "<StateTime>" + StateTime + "</StateTime>";
            sParaXml += "<EndState>"+ EndTime +"</EndState>";
            sParaXml += "<BigSize>"+ BigSize +"</BigSize>";
            sParaXml += "<SmallSize>" + SmallSize + "</SmallSize>"
            sParaXml += "</Query>";


           
            
            encodeparam = base64encode("sParaXml=" + sParaXml);
            parent.frames[1].document.location.href = "persondoc_mydoc_searchlist.aspx?"+encodeparam;
                 
           return false;
            


       }
      
        
        //单选大小
        function rbSize()
        {
            var radListItems = document.all("rbsize");
            for(var i = 1; i <   5 ; i++ )
            {
                if(radListItems[5].checked  == true)
                {
                    document.getElementById('tasize').style.display = "block";
                }
                else{
                    document.getElementById('tasize').style.display = "none";
                }
             }
        }
        
        //单选时间
        function rbDate()
        {
            var radListItems = document.all("rbDatetime");
            for(var i = 1; i <   5 ; i++ )
            {
                if(radListItems[5].checked  == true)
                {
                    document.all('ddupdate').disabled  = false;
                    document.getElementById('tbdate').style.display = "block";
                    
               }
                else{
                    document.all('ddupdate').disabled = true;
                    document.getElementById('tbdate').style.display = "none";
                     
                }
             }
        }
        
         function CliNumber(ContantName)
         {
            if(isNaN(document.getElementById(ContantName).value))
            {
                document.getElementById(ContantName).value = "";
                alert("指定大小处只允许输入数字!");
            }
         }
    </script>
</head>
<body >
   <ccit:ActionForm id="form1" runat="server">
      <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
    </asp:ScriptManager> 
 <table class="tbToolbar"  cellpadding="0" cellspacing="0" width="98%" align="center">
    <tr>
        <td align="left" colspan="2" valign="top" class="titlebar" >
           全部或者部分文件名称：
        </td>
    </tr>
     
        <tr>
        <td align="left" valign="top" class="pformleft" colspan="2" >
          <asp:TextBox ID="txtfilename" runat="server" CssClass="input" Width="98%"></asp:TextBox>
        </td>
    </tr>
        <tr>
        <td align="left" valign="top" class="pformleft" colspan="2">
           在这里寻找：
        </td>
    </tr>
            <tr class="pformleft">
        <td align="left" valign="top" class="pformleft"  colspan="2">
           <asp:DropDownList ID="ddfiletype" runat="server" Width="98%">
           <asp:ListItem Text="全部" Value="0"></asp:ListItem>
           <asp:ListItem Text="我的文档" Value="1"></asp:ListItem>
           <asp:ListItem Text="他人共享文档" Value="2"></asp:ListItem>
                </asp:DropDownList>
        </td>
                
    </tr>
    <tr  style="background-color: #E8E8E8;">
        <td align="left" valign="top" class="pformleft" colspan="2"><div style="float:left; width:90%;background-color: #E8E8E8;">什么时候修改的?</div><div style="float:right;background-color: #E8E8E8;" onclick="dodisplay('trupdate','imgUpdate')"><img id="imgUpdate" src="../images/public/movedown.gif" /></div></td>
    </tr>
    <tr id="trupdate" style="display:none;"  runat="server">
        <td colspan="2" class="pformleft">     
        
                                   <asp:RadioButtonList  ID="rbDatetime"  runat="server">
                <asp:ListItem Selected="True"  Value="0">不记得了</asp:ListItem>
                <asp:ListItem Value="1">上个星期内</asp:ListItem>
                <asp:ListItem Value="2">上个月</asp:ListItem>
                <asp:ListItem Value="3">去年一年内</asp:ListItem>
                <asp:ListItem Value="4">指定日期</asp:ListItem>
                </asp:RadioButtonList>
                 <asp:DropDownList ID="ddupdate" disabled="false" runat="server">
                <asp:ListItem Value="0">修改日期</asp:ListItem>
                <asp:ListItem Value="1">创建日期</asp:ListItem>
                <asp:ListItem Value="2">访问日期</asp:ListItem>
                </asp:DropDownList>
            <table width="100px" id="tbdate" cellpadding="0" cellspacing="0" border="0" style="display:none">
                <tr class="pformleft">
                    <td style="width:30%" align="right"> 从 </td><td style="width:70%" align="left"><input width="60px" title="时间格式：YYYY-MM-DD(无小时、分等具体时间)" onfocus="showCalendar(this,'')"   type="text" class="input" runat="server" id="txtstate" /></td>
                </tr>
                 <tr class="pformleft">
                    <td style="width:30%" align="right"> 至 </td><td style="width:70%" align="left"><input width="60px" title="时间格式：YYYY-MM-DD(无小时、分等具体时间)" onfocus="showCalendar(this,'')" type="text" id="txtEnd" class="input"  runat="server"/></td>
                </tr>
            </table>
        </td>
    </tr>
    <tr  style="background-color: #E8E8E8;">
        <td align="left" valign="top" class="pformleft" colspan="2"><div style="background-color: #E8E8E8;float:left; width:90%">大小是?</div><div style="float:right;background-color: #E8E8E8;" onclick="dodisplay('trsize','imgsize')"><img id="imgsize" src="../images/public/movedown.gif" class="getdate" title="选择日期"  relaobj="tTimeBg" /></div></td>
    </tr>
    <tr id="trsize" style="display:none;" >
        <td class="pformleft" align="left" colspan="2">
            <asp:RadioButtonList ID="rbsize" runat="server" >
                <asp:ListItem Value="0" Selected>不记得</asp:ListItem>
                <asp:ListItem Value="1">小(小于100KB)</asp:ListItem>
                <asp:ListItem Value="2">中(小于1M)</asp:ListItem>
                <asp:ListItem Value="3">大(大于1M)</asp:ListItem>
                <asp:ListItem Value="4">指定大小(以KB计算)</asp:ListItem>
            </asp:RadioButtonList>
            <div style="vertical-align:middle; display:none;" id="tasize">
            <asp:DropDownList  ID="DDsizezd" runat="server">
                <asp:ListItem Value="0">至少</asp:ListItem>
                <asp:ListItem Value="1">至多</asp:ListItem>
            </asp:DropDownList> 
           <asp:TextBox runat="server"  Width="50px" ID="txtsizezd" CssClass="input"></asp:TextBox></div>
       
        </td>
    </tr>
    <tr>
        <td colspan="2" class="pformstrip" align="center"> <br />    <asp:Button ID="btsearch" CssClass="button"  runat="server" Text="检索" />
            <br /></td>
    </tr>
  </table>
  
          <input type="hidden" id="hidFoldID" runat="server" />
        <input type="hidden" id="hidUserId" runat="server" />
    </ccit:ActionForm>
</body>
</html>
